<template>
  <dv-scroll-board :config="config" style="width:450px;height:400px" />
</template>

<script>
  import * as category from 'src/api/category'
    export default {
        name: "lunbo",
        data(){
          return{
            config: {
              header: ['id', '类名', '保质期'],
              data: []
            }
          }
        },
        methods: {
        async initData(){
            const that = this
          await  category.getAllCategory().then(function (response) {
              let rawData  = response.data.data
              let one = []
              let all = []
              for (let rawDataKey in rawData) {
                one.push(rawData[rawDataKey].gcId)
                one.push(rawData[rawDataKey].gcName)
                one.push(rawData[rawDataKey].expDate)
                all.push(one)
                one = []
              }
              that.config = {
                header: ['id', '类名', '保质期'],
                data: all,
                rowNum: 10
              }

            })
          }
        },
      async created() {
          await this.initData()
      }
    }
</script>

<style scoped>

</style>
